<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 字符串模板</title>
</head>
<body>
<h2>表达式替换</h2>
<p>模板字面量允许字符串中的表达式：</p>
<p id="demo"></p>

<script>
  let price=10;
  let VAT=0.25;
  let total=`Total:${(price*(1+VAT)).toFixed(2)}`;
  document.getElementById("demo").innerHTML=total;
</script>

</body>
</html>
<!--toFixed() 方法可把 Number 四舍五入为指定小数位数的数字-->
<!--输出结果：Total: 12.50-->